package com.github.soiff.shadow.plugins;

import com.github.soiff.shadow.api.Plugin;
import com.github.soiff.shadow.common.ResourceFinder;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by Soiff on 2016/05/20.
 *
 * @author : Soiff
 */
public class Context {

    public static List<ResourceFinder> finders = new ArrayList<>(1);

    @Getter
    private ClassLoader loader;
    @Getter
    private ResourceFinder finder;
    private List<Plugin> plugins = new ArrayList<>(1);
    private List<String> resources = new ArrayList<>(1);

    public Context(final ClassLoader loader, final ResourceFinder finder, final Collection<Plugin> plugins, final Collection<String> resources) {
        assert plugins != null && plugins.size() > 0;
        this.loader = loader;
        this.finder = finder;
        this.plugins.addAll(plugins);
        this.resources.addAll(resources);
        finders.add(finder);
    }
}
